package megrez.bussiness.schedule.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.transaction.annotation.Transactional;

import megrez.bussiness.schedule.entity.Job;
import megrez.bussiness.schedule.entity.JobLog;

/**
 * 任务日志数据接口
 *  
 * @author Lucky Yang
 * @since 0.0.1
 */
public interface JobLogRepository extends JpaRepository<JobLog, Long>, JpaSpecificationExecutor<JobLog> {
    /**
     * 查询
     * 
     * @param job 任务信息
     * @return
     */
    List<JobLog> findByJob(Job job);

    /**
     * 删除
     * 
     * @param job 任务
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    long deleteByJob(Job job);
    
}
